package com.yan.crowd.api;

import com.yan.crowd.util.ResultEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.concurrent.TimeUnit;

@FeignClient("crowd-redis")
public interface RedisApiService {

    @RequestMapping("/set/redis/key/value/remote")
    public ResultEntity<String> setRedisKeyValueRemote(@RequestParam("key") String key, @RequestParam("value") String value);

    @RequestMapping("/set/redis/key/value/with/timeout/remote")
    public ResultEntity<String> setRedisKeyValueWithTimeoutRemote(@RequestParam("key") String key,
                                                                  @RequestParam("value") String value,
                                                                  @RequestParam("time") long time,
                                                                  @RequestParam("timeunit") TimeUnit timeUnit);

    @RequestMapping("/get/redis/key")
    public ResultEntity<String> getRedisKey(@RequestParam("key") String key);

    @RequestMapping("/delete/redis/key")
    public ResultEntity<String> deleteRedisKey(@RequestParam("key") String key);

}
